{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "f6fddd3f-12bd-46a5-b878-73bccf45e41b",
   "metadata": {},
   "source": [
    "Chapter 08\n",
    "# 采用 * 和 ** 拆包\n",
    "Book_1《编程不难》 | 鸢尾花书：从加减乘除到机器学习 "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "4cb7255c-a9ae-4d9f-ac77-f77444e8e37f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(3+4j)"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 使用一个星号\n",
    "complex_list = [3, 4]\n",
    "complex(*complex_list)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "20c6e308-99ac-4693-b693-277d4115e234",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(3+4j)"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 使用两个星号\n",
    "complex_dict = {'real': 3, 'imag': 4}\n",
    "complex(**complex_dict)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
